#!/usr/bin/env python
#_*_coding:utf-8_*_
import os,sys

msg = """
\033[42;1mWelcome\033[0m
"""
print msg

host_dic = {
    '192.168.8.12':{'username':'wa1ker','ip':'192.168.8.12','passwd':'123456'},
    '192.168.8.13':{'username':'wa2ker','ip':'192.168.8.12','passwd':'123456'},
    '192.168.8.14':{'username':'root','ip':'192.168.8.12','passwd':'123456'}
}

while True:
    for id,ip in enumerate(host_dic.keys(),1):
        print id,ip
    try:
        ip_index = raw_input('Please choose one server to login:').strip()
        if ip_index == 'quit':
            print "Goodbye!"
            break
    except KeyboardInterrupt:continue
    except EOFError:continue
    if len(ip_index) == 0:continue
    options = host_dic.values()[int(ip_index)-1]
    print '\033[32;1mGoing to connect \033[0m',options['ip']
    print options['username'],options['ip'],options['passwd']
    os.system("python demo1.py %s %s %s" % (options['username'],options['ip'],options['passwd']))
